#include <stdio.h>

void point()
{
	int data[2] = {100, 200};
	int moredata[2] = {300, 400};

	int *p1, *p2, *p3;

	p1 = p2 = data;
	p3 = moredata;
	
	printf("   *p1 = %d, *p2 = %d, *p3 = %d\n", 
			*p1, *p2, *p3);	// 100 100 300

	printf("   *p1++ = %d, *++p2 = %d, (*p3)++ = %d\n", 
			*p1++, *++p2, (*p3)++);	// 100 200 300

	printf("   *p1 = %d, *p2 = %d, *p3 = %d\n", 
			*p1, *p2, *p3);	// 200 200 301
}

void modify_array()
{
	int data[2] = {100, 200};
	int *p;
	int i;
	
	p = data;
	*p = 102;
	for (i = 0; i < 2; i++)
		printf("data[%d] = %d\n", i, data[i]);	// 102  200
	
}

void double_point()
{
	int **ptr;

	//**ptr = 100;
	//printf("%d\n", **ptr);
}

int main(void)
{
	int array0[10] = {10, 15, 20, 25, 30,40};
	int array1[10] = {10, 15, 20, 25, 30,40};
	int array2[10] = {10, 15, 20, 25, 30,40};
	int array3[10] = {10, 15, 20, 25, 30,40};
	int array4[10] = {10, 15, 20, 25, 30,40};
	int array5[10] = {10, 15, 20, 25, 30,40};
	int array6[10] = {10, 15, 20, 25, 30,40};
	int array7[10] = {10, 15, 20, 25, 30,40};
	int *p;
	
	p = array0;
	printf("*p++ = %d\n", *p++);	// 10
	printf("*p++ = %d\n", *p++);	// 15
	printf("*p++ = %d\n", *p++);	// 20
	
	p = array1;
	printf("\t*++p = %d\n", *++p);	// 15
	printf("\t*++p = %d\n", *++p);	// 20
	printf("\t*++p = %d\n", *++p);	// 25
	
	p = array2;
	printf("(*p)++ = %d\n", (*p)++);	// 10
	printf("(*p)++ = %d\n", (*p)++);	// 11
	printf("(*p)++ = %d\n", (*p)++);	// 12
	
	p = array3;
	printf("\t++*p = %d\n", ++*p);	// 11
	printf("\t++*p = %d\n", ++*p);	// 12
	printf("\t++*p = %d\n", ++*p);	// 13
	
	p = array4;
	printf("++(*p) = %d\n", ++(*p));	// 11
	printf("++(*p) = %d\n", ++(*p));	// 12
	printf("++(*p) = %d\n", ++(*p));	// 13
	
	point();
	modify_array();
	double_point();

	return 0;
}

